package com.example.hanchen.yongkanggy.home.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.hanchen.yongkanggy.R;
import com.example.hanchen.yongkanggy.home.activity.FeedbackActivity;
import com.example.hanchen.yongkanggy.home.activity.LoginActivity;
import com.example.hanchen.yongkanggy.home.activity.SettingActivity;
import com.example.hanchen.yongkanggy.home.base.BaseFragment;
import com.example.hanchen.yongkanggy.utils.PreferencesUtil;
import com.example.hanchen.yongkanggy.utils.SharePreferencesConsts;

/**
 * 我的主界面
 */

public class MeFragment extends BaseFragment {

    LinearLayout ll_particulars,ll_feedback;
    TextView tv_out;
    public static MeFragment newInstance() {//int typePosition
        Bundle args = new Bundle();
        MeFragment fragment = new MeFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_me, container, false);
        ll_particulars = view.findViewById(R.id.ll_particulars);
        ll_feedback = view.findViewById(R.id.ll_feedback);
        tv_out = view.findViewById(R.id.tv_out);

        ll_particulars.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new android.content.Intent(getActivity(), SettingActivity.class));
            }
        });

        ll_feedback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new android.content.Intent(getActivity(), FeedbackActivity.class));
            }
        });

        tv_out.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
                PreferencesUtil.saveObject(SharePreferencesConsts.LOGINSMS, "");
                startActivity(new android.content.Intent(getActivity(), LoginActivity.class));
            }
        });

        return view;
    }
}
